package com.hytc.mymall.pager;

import android.content.Context;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.TextView;
import com.hytc.mymall.R;
import com.hytc.mymall.base.BasePager;
import com.hytc.mymall.bean.HomeInfoBean;

import java.util.List;

/**
 * Created by Administrator on 2016/12/1.
 */

public class pager3 extends BasePager implements AdapterView.OnItemClickListener
{
    private ListView lv;
    private TextView tv_title;

    public pager3(final Context context, final int n, final HomeInfoBean.HomeInfo homeInfo, final String s) {
        super(context, n, homeInfo, s);
    }

    @Override
    public void initData() {
        super.initData();
            if (!this.tag.equals("page3")) {
                return;
            }
            String text =this.context.getResources().getString(R.string.union_public_welfare_rank);
            List<HomeInfoBean.Home2> list = this.homeinfo.home2;
            while (true) {
                this.tv_title.setText((CharSequence)text);
                if (list == null) {
                    return;
                }
                try {
                    if (list.size() > 0) {
                        //光荣榜数据展示
//                        final UnionWelfareRankAdapter adapter = new UnionWelfareRankAdapter(this.context, list, R.layout.item_unionrank);
//                        new UnionWelfareRankViewHolder(this.context, list, R.layout.item_unionrank);
//                        this.lv.setAdapter((ListAdapter)adapter);
                        return;
                    }
                    list = this.homeinfo.home6;
                    continue;
                }
                catch (Exception ex) {
                    ex.printStackTrace();
                }
                break;
            }
    }

    @Override
    public void initView() {
        super.initView();
        this.tv_title = (TextView)this.rootView.findViewById(R.id.tv_page3_title);
        this.lv = (ListView)this.rootView.findViewById(R.id.lv_main_page3);
        this.rootView.setFocusable(true);
        this.lv.setOnItemClickListener((AdapterView.OnItemClickListener)this);
    }
    //光荣榜详情
    public void onItemClick(final AdapterView<?> adapterView, final View view, final int n, final long n2) {
//        final Intent intent = new Intent(this.context, (Class)UnionWelfareRankActivity.class);
//        intent.putExtra("isRank", true);
//        intent.putExtra("tag", this.tag);
//        this.context.startActivity(intent);
    }
}

